//
//  HttpPlatformConnect.h
//  XTCloud
//
//  Created by QA on 2018/1/10.
//  Copyright © 2018年 ShangHai HaoLei Software Technology Co., Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"
#import "HttpPlatformOutputResult.h"
#import "HttpPlatformInputRequest.h"

typedef NS_ENUM (NSUInteger, PlatformHttpMethod) {
    Platform_HttpMethod_GET,
    Platform_HttpMethod_POST
};

//用于回调请求成功或者失败的信息
typedef void (^ PlatformSuccessHandle)(HttpPlatformOutputResult* _Nullable responseObject);
typedef void (^ PlatformFailureHandle)(NSError *_Nonnull error);

///// 所有简单指针对象都被假定为nonnull，因此我们只需要去指定那些nullable的指针即可。
NS_ASSUME_NONNULL_BEGIN
@interface HttpPlatformConnect : NSObject

//实例化
+ (instancetype)shareInstance;

//平台接口
- (NSURLSessionDataTask *)requestWithParams:(HttpPlatformInputRequest*)httpInputParams
                                    success:(PlatformSuccessHandle)successBlock
                                    failure:(PlatformFailureHandle)failureBlock;

/**
 *取消所有执行请求
 */
- (void)cancelAllOperations;

@end

NS_ASSUME_NONNULL_END
